//
//  QSProblemProcessingInterface.m
//  DigitalEconomy_iOS
//
//  Created by Ding on 2020/4/3.
//  Copyright © 2020 DingC. All rights reserved.
//

#import "QSProblemProcessingInterface.h"
#import "QSRequestManager.h"
@implementation QSProblemProcessingInterface

/**
* @brief 获取问题上报主列表
*/
+ (void)getApiProblemProcessingListWithPageIndex:(NSInteger)pageIndex
                                           State:(NSInteger)state
                                           Month:(NSString *)month
                                        andBlock:(void (^)(ResponseMessage *rspStatusAndMessage, QSProblemDealingListModel *resultModel))block{
    NSString *requestURL = [[kBaseUrlPrefix stringByAppendingString:kSanFangBack] stringByAppendingString:kProblemDealList];
    NSMutableDictionary *bodyDic = [[NSMutableDictionary alloc] initWithCapacity:0];
    [bodyDic setObject:@(pageIndex) forKey:@"pageIndex"];
    [bodyDic setObject:@(10) forKey:@"pageSize"];
    [bodyDic setValue:@(state) forKey:@"state"];
    if (month) {        
        [bodyDic setValue:month forKey:@"month"];
    }
    
    [QSRequestManager executeTokenGET:requestURL requestBody:bodyDic andBlock:^(ResponseMessage *rspStatusAndMessage, NSDictionary *responseDataDic) {
        if (rspStatusAndMessage.code == kResponseSuccessCode) {
            QSProblemDealingListModel *model = [QSProblemDealingListModel mj_objectWithKeyValues:responseDataDic];
            block(rspStatusAndMessage, model);
        }
    }];
}

/**
 * @brief 提交问题处理
 * Id 问题id
 * info 处理信息
*/
+ (void)postApiProblemDealWithId:(NSInteger)problemId
                            Info:(NSString *)info
                        andBlock:(void (^)(ResponseMessage *rspStatusAndMessage, NSDictionary *result))block{
    NSString *requestURL = [[kBaseUrlPrefix stringByAppendingString:kSanFangBack] stringByAppendingString:kProblemDeal];
    NSMutableDictionary *bodyDic = [[NSMutableDictionary alloc] initWithCapacity:0];
    [bodyDic setValue:@(problemId) forKey:@"id"];
    [bodyDic setValue:info forKey:@"info"];
    
    [QSRequestManager executeJSONTokenPOST:requestURL requestBody:bodyDic andBlock:^(ResponseMessage *rspStatusAndMessage, NSDictionary *responseDataDic) {
        if (rspStatusAndMessage.code == kResponseSuccessCode) {
            block(rspStatusAndMessage, responseDataDic);
        }else{
            block(rspStatusAndMessage, responseDataDic);
        }
    }];
    
}


@end
